<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
          xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">
	<head>
		<link href="http://www.1000thinktank.com/favicon.ico"
			rel="shortcut icon" />
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<meta name="Keywords" content="" />
		<meta name="description" content="" />
		<title>千人智库</title>
		<script type="text/jscript" src="/js/jquery-1.7.2.min.js"></script>
		<link href="/css/tjxq_css.css" rel="stylesheet" type="text/css" />
		<script>
var reyx= /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;
var re = /^1\d{10}$/;
function submit_form(){
	var flag =dealFormdata();
	
	if(!flag){
		return false;
		}
	var conn= $('#attr_projectName').val();
	$('#title').val(conn);
	$('#form1').submit();
}
$(document).ready(function(){
	var mes=3 ;//${message};
	if(mes=='1'){
		  $("#i_error").show();
		 // $("#i_error").hide(6000);
		}
	if(mes=='2'){
		 // $("#i_error").show();
		 // $("#ctl00_ContentPlaceHolder1_FieldValidator_Captcha").hide(6000);
			alert( "验证码错误!");
		}
	});
	function check(value,id){
 		if(value == '' ){
 			$('#'+id).show();
 		}else{
 			if(id=='i_attr_email'){
 				if(!reyx.test(value)){
					$('#i_attr_email2').show();
				}else{
					$('#i_attr_email2').hide();
				}
 			}
 			if(id=='i_attr_phone'){
 				if(!re.test(value)){
 					$('#i_attr_phone2').show();
 				}else{
 					$('#i_attr_phone2').hide();
 				}
 			}
 			$('#'+id).hide();
 		}
 	}

//验证form表单数据
function dealFormdata(){
    var flag = true;

    var val=$('input:radio[name="attr_project_type"]:checked').val();
    if(val ==null){
    	$('#i_project_type').show();
		flag = false;
        }else $('#i_project_type').hide();
    
	var username = $('#attr_name').val();
	if(username == ''){
		$('#i_attr_name').show();
		flag = false;
	}else $('#i_attr_name').hide();
	var jigou = $('#attr_company').val();
	if(jigou == ''){
		$('#i_attr_company').show();
		flag = false;
	}else $('#i_attr_company').hide();
	var phone = $('#attr_phone').val();
	if(phone == ''){
		$('#i_attr_phone').show();
		flag = false;
	}else{
	 	$('#i_attr_phone').hide();
		if(!re.test(phone)){
			$('#i_attr_phone2').show();
			flag = false;
		}else{$('#i_attr_phone2').hide();}
	}
	var email = $('#attr_email').val();
	if(email == ''){
		$('#i_attr_email').show();
		flag = false;
	}else{
		$('#i_attr_email').hide();
		if(!reyx.test(email)){
			$('#i_attr_email2').show();
			flag = false;
		}else{
			$('#i_attr_email2').hide();
		}
	}
	var projectName = $('#attr_projectName').val();
	if(projectName == ''){
		$('#i_attr_projectName').show();
		flag = false;
	}else $('#i_attr_projectName').hide();

	var txt = $('#txt').val();
	if(txt == ''){
		$('#i_txt').show();
		flag = false;
	}else $('#i_txt').hide();

	var captchas = $('#captchas').val();
	if(captchas == ''){
		$('#i_captchas').show();
		flag = false;
	}else $('#i_captchas').hide();

	return flag;
}
</script>
		
	</head>
	<body id="shenbao11">
		<form id="form1" th:action="@{/addDemand}" method="post"
			>
			<div class="mainBody">
				<div class="main_line1">
					<div class="main_line2">
						<div class="ewm_pic">
							<img src="/images/req.jpg" />
						</div>
						<div class="main_tab">
							<input type="hidden" id="date" value="" />
							<div class="main_tab_top">
								<label>
									<input type="radio" name="attr_project_type" value="1"
										id="RadioGroup1_0" />
									我找技术、项目、人才
								</label>
								&nbsp;&nbsp;&nbsp;&nbsp;
								<label>
									<input type="radio" name="attr_project_type" value="2"
										id="RadioGroup1_1" />
									我有技术、项目
								</label><i style="color: red; padding-left: 10px; display: none;"
											id="i_project_type">类型选项不能为空！</i>
							</div>
							<div class="main_tab_m">
								<ul class="reg_ul">
									<li>
										<span>姓名：</span>
										<input type="text" id="attr_name" name="attr_name" value=""
											onblur="check(this.value,'i_attr_name')" placeholder="请输入您的姓名"
											class=""><i style="color: red; padding-left: 10px; display: none; font-size: 30px;"
											id="i_attr_name">姓名不能为空！</i>
									</li>
									<li>
										<span>机构：</span>
										<input type="text" id="attr_company" name="attr_company"
											value="" onblur="check(this.value,'i_attr_company')" placeholder="请输入您所在机构的名称"
											class=""><i style="color: red; padding-left: 10px; display: none; font-size: 30px;"
											id="i_attr_company">机构不能为空！</i>
									</li>
									<li>
										<span>电话：</span>
										<input type="text"  placeholder="请输入您的联系方式"
											class="" id="attr_phone" value="" name="attr_phone"
											onblur="check(this.value,'i_attr_phone')" />
										<i style="color: red; padding-left: 10px; display: none; font-size: 30px;"
											id="i_attr_phone">手机不能为空！</i>
										<i style="color: red; padding-left: 10px; display: none; font-size: 30px;"
											id="i_attr_phone2">手机号码有误！</i>
									</li>
									<li>
										<span>邮箱：</span>
										<input type="text"  placeholder="请输入您的邮箱"
											class="" id="attr_email" name="attr_email" value=""
											onblur="check(this.value,'i_attr_email')" />
										<i style="color: red; padding-left: 10px; display: none; font-size: 30px;"
											id="i_attr_email">邮箱不能为空！</i>
										<i style="color: red; padding-left: 10px; display: none; font-size: 30px;"
											id="i_attr_email2">邮箱格式有误！</i>
									</li>
									<li>
										<span>需求名称：</span>
										<input type="text"   placeholder="" class="" id="attr_projectName" value=""
											name="attr_projectName"
											onblur="check(this.value,'i_attr_projectName')" />
										<i style="color: red; padding-left: 10px; display: none; font-size: 30px;"
											id="i_attr_projectName">需求名称不能为空！</i>
									</li>
									<li>
										<span>需求描述：</span>
										<input type="text"  id="txt" name="txt"  
											onblur="check(this.value,'i_txt')"/>
										<i style="color: red; padding-left: 10px; display: none; font-size: 30px;"
											id="i_txt">需求描述 不能为空！</i>
									</li>
									<li>
										<span>验证码：</span>
										<input type="text" name="captchas" value="" placeholder="" class="yzm" id="captchas">
										<div class="yzm_pic">
											<img
															style="height: 35px; width: 70px; border-width: 0px; border-style: solid; border-color: Black; border-width: 0px;"
															onclick="this.src='/getImage?d='+new Date()*1"
															id="ctl00_ContentPlaceHolder1_Image2" title="69482"
															src="/getImage" />
												
										</div>
													<i style="color: red; padding-left: 10px; display: none; font-size: 30px;"
											id="i_captchas">验证码不能为空！</i>
									</li>
								</ul>
							</div>
							<div class="main_tab_bottom">
								<button type="button" name="zc" class="red_button" onclick="submit_form()">
									一键提交
								</button>
								<br />
								<a href="/">
								<img src="/images/back_icon.png" /></a>
							</div>
						</div>
					</div>
				</div>
			</div>

		</form>
		
	</body>
</html>